FILE(GLOB cc_sources *.cc)
FILE(GLOB cc_widgets_sources widgets/*.cc)
FILE(GLOB cc_containers_sources containers/*.cc)
FILE(GLOB cc_gl_sources gl/*.cc)
FILE(GLOB cc_dnd_sources dnd/*.cc)
FILE(GLOB cc_doc_sources doc/*.cc)

if(BUOLA_PLATFORM_MAC)
    FILE(GLOB cc_platform_sources cocoa/*.mm)
    find_library(COCOA_LIB cocoa)
    set(GUI_PLATFORM_LIBRARIES ${COCOA_LIB})
elseif(BUOLA_PLATFORM_LINUX)
    include(MyFindX11)
    FILE(GLOB cc_platform_sources x11/*.cc)
    set(GUI_PLATFORM_LIBRARIES ${X11_LIBRARIES} ${XEXTENSIONS_LDFLAGS})
endif()


find_package(OpenGL REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIR_freetype2} ${OPENGL_INCLUDE_DIR})

add_library(buolagui SHARED ${cc_sources} ${cc_widgets_sources} ${cc_gl_sources} ${cc_containers_sources}
                ${cc_platform_sources} ${cc_dnd_sources} ${cc_doc_sources})

include(GLSLToHeader)
glsl_to_header_folder(buolagui gl/shaders "buola::gl::shaders")

target_link_libraries(buolagui buolacore buolaimage ${GUI_PLATFORM_LIBRARIES} ${OPENGL_gl_LIBRARY})

set_target_properties(buolagui PROPERTIES VERSION ${GENERIC_LIB_VERSION}
                                        SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS buolagui DESTINATION ${LIB_INSTALL_DIR})
